//
//  SHEStrokeLabel.m
//  SHEPuzzleFigure
//
//  Created by SW mini on 2019/11/25.
//  Copyright © 2019 Figure. All rights reserved.
//

#import "SHEStrokeLabel.h"

@implementation SHEStrokeLabel

- (void)drawTextInRect:(CGRect)rect{
    
    //描边
    
    CGContextRef c = UIGraphicsGetCurrentContext ();
    
    CGContextSetLineWidth (c, 7);
    
    CGContextSetLineJoin (c, kCGLineJoinRound);
    
    CGContextSetTextDrawingMode (c, kCGTextStroke);
    
    //描边颜色
    
    self.textColor = [UIColor colorWithRed:176.0f/255.0f green:51.0f/255.0f blue:54.0f/255.0f alpha:1];
    
    [super drawTextInRect:rect];
    
    //文字颜色
    
    self.textColor = [UIColor whiteColor];
    
    CGContextSetTextDrawingMode (c, kCGTextFill);
    
    [super drawTextInRect:rect];
    
    
    //不倾斜字体
    CGAffineTransform matrix = CGAffineTransformMake(1, 0, tanf(-15 * (CGFloat)M_PI), 1, 0, 0);
    self.transform = matrix;
    
    //倾斜字体
    //    CGAffineTransform matrix = CGAffineTransformMake(1, 0, tanf(-15 * (CGFloat)M_PI / 180), 1, 0, 0);
    //    self.transform = matrix;
}

@end
